<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>	
	<style type="text/css">
		.btns{
			width:500px;
			height:50px;
		}

		.btns input{
			width:100px;
			height:50px;
			background-color:#ddd;
			color:#666;
			border:0px;
		}

		.btns input.cur{
			background-color:gold;
		}


		.contents div{
			width:500px;
			height:300px;
			background-color: gold;
			display:none;
			line-height:300px;
			text-align:center;
		}

		.contents div.active{
			display: block;
		}



	</style>
	<script type="text/javascript">
		window.onload = function(){

			var aBtn = document.getElementById('btns').getElementsByTagName('input');
			var aCon = document.getElementById('contents').getElementsByTagName('div');


			for(var i=0;i<aBtn.length;i++){

				(function(i){

						aBtn[i].onclick = function(){

						for(var j=0;j<aBtn.length;j++){
							aBtn[j].className = '';
							aCon[j].className = '';
						}
						
						this.className = 'cur';
						aCon[i].className = 'active';

					}

				})(i)		

			}

		}
		
	</script>
</head>
<body>
	<div class="btns" id="btns">
		<input type="button" value="tab01" class="cur">
		<input type="button" value="tab02">
		<input type="button" value="tab03">
	</div>

	<div class="contents" id="contents">
		<div class="active">tab文字内容一</div>
		<div>tab文字内容二</div>
		<div>tab文字内容三</div>
	</div>
</body>
</html>